home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / dplay.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  39.8 KB  |  1,069 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1994-1996 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       dplay.h
  6.  *  Content:    DirectPlay include file
  7.  *
  8.  ***************************************************************************/
  9.  
  10. #ifndef __DPLAY_INCLUDED__
  11. #define __DPLAY_INCLUDED__
  12. #pragma option push -b
  13.  
  14. #include <ole2.h>       // for DECLARE_INTERFACE and HRESULT
  15.  
  16. #define _FACDP  0x877
  17. #define MAKE_DPHRESULT( code )    MAKE_HRESULT( 1, _FACDP, code )
  18.  
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22.  
  23. /*
  24.  * GUIDS used by DirectPlay objects
  25.  */
  26. DEFINE_GUID(IID_IDirectPlay2, 0x2b74f7c0, 0x9154, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3);
  27. DEFINE_GUID(IID_IDirectPlay2A,0x9d460580, 0xa822, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82);
  28.  
  29.  
  30. /****************************************************************************
  31.  *
  32.  * DirectPlay Structures
  33.  *
  34.  * Various structures used to invoke DirectPlay.
  35.  *
  36.  ****************************************************************************/
  37.  
  38. #ifndef IDIRECTPLAY2_OR_GREATER
  39. typedef struct IDirectPlay        FAR *LPDIRECTPLAY;
  40. #else
  41. typedef struct IUnknown           FAR *LPDIRECTPLAY;
  42. #endif
  43.  
  44. typedef struct IDirectPlay2       FAR *LPDIRECTPLAY2;
  45. typedef struct IDirectPlay2       FAR *LPDIRECTPLAY2A;
  46. typedef struct IDirectPlay2       IDirectPlay2A;
  47.  
  48. /*
  49.  * DPID
  50.  * DirectPlay player and group ID
  51.  */
  52. typedef DWORD DPID, FAR *LPDPID;
  53.  
  54. /*
  55.  * DPID that system messages come from
  56.  */
  57. #define DPID_SYSMSG         0
  58.  
  59. /*
  60.  * DPID representing all players in the session
  61.  */
  62. #define DPID_ALLPLAYERS     0
  63.  
  64. /*
  65.  * DPCAPS
  66.  * Used to obtain the capabilities of a DirectPlay object
  67.  */
  68. typedef struct
  69. {
  70.     DWORD dwSize;               // Size of structure, in bytes
  71.     DWORD dwFlags;              // DPCAPS_xxx flags
  72.     DWORD dwMaxBufferSize;      // Maximum message size, in bytes,  for this service provider
  73.     DWORD dwMaxQueueSize;       // Obsolete. 
  74.     DWORD dwMaxPlayers;         // Maximum players/groups (local + remote)
  75.     DWORD dwHundredBaud;        // Bandwidth in 100 bits per second units; 
  76.                                 // i.e. 24 is 2400, 96 is 9600, etc.
  77.     DWORD dwLatency;            // Estimated latency; 0 = unknown
  78.     DWORD dwMaxLocalPlayers;    // Maximum # of locally created players allowed
  79.     DWORD dwHeaderLength;       // Maximum header length, in bytes, on messages
  80.                                 // added by the service provider
  81.     DWORD dwTimeout;            // Service provider's suggested timeout value
  82.                                 // This is how long DirectPlay will wait for 
  83.                                 // responses to system messages
  84. } DPCAPS, FAR *LPDPCAPS;
  85.  
  86. /*
  87.  * This DirectPlay object is the session host.  If the host exits the
  88.  * session, another application will become the host and receive a
  89.  * DPSYS_HOST system message.
  90.  */
  91. #define DPCAPS_ISHOST               0x00000002
  92.  
  93. /*
  94.  * The service provider bound to this DirectPlay object can optimize
  95.  * group messaging.
  96.  */
  97. #define DPCAPS_GROUPOPTIMIZED       0x00000008
  98.  
  99. /*
  100.  * The service provider bound to this DirectPlay object can optimize
  101.  * keep alives (see DPSESSION_KEEPALIVE)
  102.  */
  103. #define DPCAPS_KEEPALIVEOPTIMIZED   0x00000010
  104.  
  105. /*
  106.  * The service provider bound to this DirectPlay object can optimize
  107.  * guaranteed message delivery.
  108.  */
  109. #define DPCAPS_GUARANTEEDOPTIMIZED  0x00000020
  110.  
  111. /*
  112.  * This DirectPlay object supports guaranteed message delivery.
  113.  */
  114. #define DPCAPS_GUARANTEEDSUPPORTED  0x00000040
  115.  
  116.  
  117.  
  118.  
  119. /*
  120.  * DPSESSIONDESC2
  121.  * Used to describe the properties of a DirectPlay
  122.  * session instance
  123.  */
  124. typedef struct
  125. {
  126.     DWORD   dwSize;             // Size of structure
  127.     DWORD   dwFlags;            // DPSESSION_xxx flags
  128.     GUID    guidInstance;       // ID for the session instance
  129.     GUID    guidApplication;    // GUID of the DirectPlay application.
  130.                                 // GUID_NULL for all applications.
  131.     DWORD   dwMaxPlayers;       // Maximum # players allowed in session
  132.     DWORD   dwCurrentPlayers;   // Current # players in session (read only)
  133.     union
  134.     {                           // Name of the session
  135.         LPWSTR  lpszSessionName;    // Unicode
  136.         LPSTR   lpszSessionNameA;   // ANSI
  137.     };
  138.     union
  139.     {                           // Password of the session (optional)
  140.         LPWSTR  lpszPassword;       // Unicode
  141.         LPSTR   lpszPasswordA;      // ANSI
  142.     };
  143.     DWORD   dwReserved1;        // Reserved for future MS use.
  144.     DWORD   dwReserved2;
  145.     DWORD   dwUser1;            // For use by the application
  146.     DWORD   dwUser2;
  147.     DWORD   dwUser3;
  148.     DWORD   dwUser4;
  149. } DPSESSIONDESC2, FAR *LPDPSESSIONDESC2;
  150.  
  151. /*
  152.  * LPCDPSESSIONDESC2
  153.  * A constant pointer to DPSESSIONDESC2
  154.  */
  155. typedef const DPSESSIONDESC2 FAR *LPCDPSESSIONDESC2;
  156.  
  157. /*
  158.  * Applications cannot create new players in this session.
  159.  */
  160. #define DPSESSION_NEWPLAYERSDISABLED    0x00000001 
  161.  
  162. /*
  163.  * If the DirectPlay object that created the session, the host,
  164.  * quits, then the host will attempt to migrate to another
  165.  * DirectPlay object so that new players can continue to be created
  166.  * and new applications can join the session.
  167.  */
  168. #define DPSESSION_MIGRATEHOST           0x00000004
  169.  
  170. /*
  171.  * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom 
  172.  * fields in player messages.  This cuts two DWORD's off the message 
  173.  * overhead.
  174.  */
  175. #define DPSESSION_NOMESSAGEID           0x00000008
  176.  
  177.  
  178. /*
  179.  * This flag tells DirectPlay to not allow any new applications to
  180.  * join the session.  Applications already in the session can still
  181.  * create new players.
  182.  */
  183. #define DPSESSION_JOINDISABLED          0x00000020
  184.  
  185. /*
  186.  * This flag tells DirectPlay to detect when remote players 
  187.  * exit abnormally (e.g. their computer or modem gets unplugged)
  188.  */
  189. #define DPSESSION_KEEPALIVE             0x00000040
  190.  
  191. /*
  192.  * This flag tells DirectPlay not to send a message to all players
  193.  *      when a players remote data changes
  194.  */
  195. #define DPSESSION_NODATAMESSAGES        0x00000080
  196.  
  197. /*
  198.  * DPNAME
  199.  * Used to hold the name of a DirectPlay entity
  200.  * like a player or a group
  201.  */
  202. typedef struct 
  203. {
  204.     DWORD   dwSize;             // Size of structure
  205.     DWORD   dwFlags;            // Not used. Must be zero.
  206.     union
  207.     {                           // The short or friendly name
  208.         LPWSTR  lpszShortName;      // Unicode
  209.         LPSTR   lpszShortNameA;     // ANSI
  210.     };
  211.     union
  212.     {                           // The long or formal name
  213.         LPWSTR  lpszLongName;       // Unicode
  214.         LPSTR   lpszLongNameA;      // ANSI
  215.     };
  216.  
  217. } DPNAME, FAR *LPDPNAME;
  218.  
  219. /*
  220.  * LPCDPNAME
  221.  * A constant pointer to DPNAME
  222.  */
  223. typedef const DPNAME FAR *LPCDPNAME;
  224.  
  225.  
  226. /****************************************************************************
  227.  *
  228.  * Prototypes for DirectPlay callback functions
  229.  *
  230.  ****************************************************************************/
  231.  
  232. /*
  233.  * Callback for IDirectPlay2::EnumSessions
  234.  */
  235. typedef BOOL (FAR PASCAL * LPDPENUMSESSIONSCALLBACK2)(
  236.     LPCDPSESSIONDESC2   lpThisSD,
  237.     LPDWORD             lpdwTimeOut,
  238.     DWORD               dwFlags,
  239.     LPVOID              lpContext );
  240.  
  241. /*
  242.  * This flag is set on the EnumSessions callback dwFlags parameter when
  243.  * the time out has occurred. There will be no session data for this 
  244.  * callback. If *lpdwTimeOut is set to a non-zero value and the 
  245.  * EnumSessionsCallback function returns TRUE then EnumSessions will 
  246.  * continue waiting until the next timeout occurs. Timeouts are in 
  247.  * milliseconds.
  248.  */
  249. #define DPESC_TIMEDOUT          0x00000001
  250.  
  251.  
  252. /*
  253.  * Callback for IDirectPlay2::EnumPlayers
  254.  *              IDirectPlay2::EnumGroups
  255.  *              IDirectPlay2::EnumGroupPlayers
  256.  */
  257. typedef BOOL (FAR PASCAL *LPDPENUMPLAYERSCALLBACK2)(
  258.     DPID            dpId,
  259.     DWORD           dwPlayerType,
  260.     LPCDPNAME       lpName,
  261.     DWORD           dwFlags,
  262.     LPVOID          lpContext );
  263.  
  264.  
  265. /*
  266.  * Unicode callback for DirectPlayEnumerate
  267.  * This callback prototype will be used if compiling
  268.  * for Unicode strings
  269.  */
  270. typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACK)(
  271.     LPGUID      lpguidSP,
  272.     LPWSTR      lpSPName,
  273.     DWORD       dwMajorVersion,
  274.     DWORD       dwMinorVersion,
  275.     LPVOID      lpContext);
  276.  
  277. /*
  278.  * ANSI callback for DirectPlayEnumerate
  279.  * This callback prototype will be used if compiling
  280.  * for ANSI strings
  281.  */
  282. typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACKA)(
  283.     LPGUID      lpguidSP,
  284.     LPSTR       lpSPName,
  285.     DWORD       dwMajorVersion,     
  286.     DWORD       dwMinorVersion,
  287.     LPVOID      lpContext);
  288.  
  289. /*
  290.  * API's
  291.  */
  292.  
  293. #ifdef UNICODE
  294. #define DirectPlayEnumerate     DirectPlayEnumerateW
  295. #else
  296. #define DirectPlayEnumerate     DirectPlayEnumerateA
  297. #endif // UNICODE
  298.  
  299. extern HRESULT WINAPI DirectPlayEnumerateA( LPDPENUMDPCALLBACKA, LPVOID );
  300. extern HRESULT WINAPI DirectPlayEnumerateW( LPDPENUMDPCALLBACK, LPVOID );
  301. extern HRESULT WINAPI DirectPlayCreate( LPGUID lpGUID, LPDIRECTPLAY *lplpDP, IUnknown *pUnk);
  302.  
  303. /****************************************************************************
  304.  *
  305.  * IDirectPlay2 (and IDirectPlay2A) Interface
  306.  *
  307.  ****************************************************************************/
  308.  
  309. #undef INTERFACE
  310. #define INTERFACE IDirectPlay2
  311. DECLARE_INTERFACE_( IDirectPlay2, IUnknown )
  312. {
  313.     /*** IUnknown methods ***/
  314.     STDMETHOD(QueryInterface)       (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  315.     STDMETHOD_(ULONG,AddRef)        (THIS)  PURE;
  316.     STDMETHOD_(ULONG,Release)       (THIS) PURE;
  317.     /*** IDirectPlay2 methods ***/
  318.     STDMETHOD(AddPlayerToGroup)     (THIS_ DPID, DPID) PURE;
  319.     STDMETHOD(Close)                (THIS) PURE;
  320.     STDMETHOD(CreateGroup)          (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE;
  321.     STDMETHOD(CreatePlayer)         (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE;
  322.     STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE;
  323.     STDMETHOD(DestroyGroup)         (THIS_ DPID) PURE;
  324.     STDMETHOD(DestroyPlayer)        (THIS_ DPID) PURE;
  325.     STDMETHOD(EnumGroupPlayers)     (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
  326.     STDMETHOD(EnumGroups)           (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
  327.     STDMETHOD(EnumPlayers)          (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE;
  328.     STDMETHOD(EnumSessions)         (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE;
  329.     STDMETHOD(GetCaps)              (THIS_ LPDPCAPS,DWORD) PURE;
  330.     STDMETHOD(GetGroupData)         (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE;
  331.     STDMETHOD(GetGroupName)         (THIS_ DPID,LPVOID,LPDWORD) PURE;
  332.     STDMETHOD(GetMessageCount)      (THIS_ DPID, LPDWORD) PURE;
  333.     STDMETHOD(GetPlayerAddress)     (THIS_ DPID,LPVOID,LPDWORD) PURE;
  334.     STDMETHOD(GetPlayerCaps)        (THIS_ DPID,LPDPCAPS,DWORD) PURE;
  335.     STDMETHOD(GetPlayerData)        (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE;
  336.     STDMETHOD(GetPlayerName)        (THIS_ DPID,LPVOID,LPDWORD) PURE;
  337.     STDMETHOD(GetSessionDesc)       (THIS_ LPVOID,LPDWORD) PURE;
  338.     STDMETHOD(Initialize)           (THIS_ LPGUID) PURE;
  339.     STDMETHOD(Open)                 (THIS_ LPDPSESSIONDESC2,DWORD) PURE;
  340.     STDMETHOD(Receive)              (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE;
  341.     STDMETHOD(Send)                 (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE;
  342.     STDMETHOD(SetGroupData)         (THIS_ DPID,LPVOID,DWORD,DWORD) PURE;
  343.     STDMETHOD(SetGroupName)         (THIS_ DPID,LPDPNAME,DWORD) PURE;
  344.     STDMETHOD(SetPlayerData)        (THIS_ DPID,LPVOID,DWORD,DWORD) PURE;
  345.     STDMETHOD(SetPlayerName)        (THIS_ DPID,LPDPNAME,DWORD) PURE;
  346.     STDMETHOD(SetSessionDesc)       (THIS_ LPDPSESSIONDESC2,DWORD) PURE;
  347. };
  348.  
  349. /****************************************************************************
  350.  *
  351.  * IDirectPlay2 interface macros
  352.  *
  353.  ****************************************************************************/
  354.  
  355. #if !defined(__cplusplus) || defined(CINTERFACE)
  356.  
  357. #define IDirectPlay2_QueryInterface(p,a,b)          (p)->lpVtbl->QueryInterface(p,a,b)
  358. #define IDirectPlay2_AddRef(p)                      (p)->lpVtbl->AddRef(p)
  359. #define IDirectPlay2_Release(p)                     (p)->lpVtbl->Release(p)
  360. #define IDirectPlay2_AddPlayerToGroup(p,a,b)        (p)->lpVtbl->AddPlayerToGroup(p,a,b)
  361. #define IDirectPlay2_Close(p)                       (p)->lpVtbl->Close(p)
  362. #define IDirectPlay2_CreateGroup(p,a,b,c,d,e)       (p)->lpVtbl->CreateGroup(p,a,b,c,d,e)
  363. #define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f)    (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f)
  364. #define IDirectPlay2_DeletePlayerFromGroup(p,a,b)   (p)->lpVtbl->DeletePlayerFromGroup(p,a,b)
  365. #define IDirectPlay2_DestroyGroup(p,a)              (p)->lpVtbl->DestroyGroup(p,a)
  366. #define IDirectPlay2_DestroyPlayer(p,a)             (p)->lpVtbl->DestroyPlayer(p,a)
  367. #define IDirectPlay2_EnableNewPlayers(p,a)          (p)->lpVtbl->EnableNewPlayers(p,a)
  368. #define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e)  (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e)
  369. #define IDirectPlay2_EnumGroups(p,a,b,c,d)          (p)->lpVtbl->EnumGroups(p,a,b,c,d)
  370. #define IDirectPlay2_EnumPlayers(p,a,b,c,d)         (p)->lpVtbl->EnumPlayers(p,a,b,c,d)
  371. #define IDirectPlay2_EnumSessions(p,a,b,c,d,e)      (p)->lpVtbl->EnumSessions(p,a,b,c,d,e)
  372. #define IDirectPlay2_GetCaps(p,a,b)                 (p)->lpVtbl->GetCaps(p,a,b)
  373. #define IDirectPlay2_GetMessageCount(p,a,b)         (p)->lpVtbl->GetMessageCount(p,a,b)
  374. #define IDirectPlay2_GetGroupData(p,a,b,c,d)        (p)->lpVtbl->GetGroupData(p,a,b,c,d)
  375. #define IDirectPlay2_GetGroupName(p,a,b,c)          (p)->lpVtbl->GetGroupName(p,a,b,c)
  376. #define IDirectPlay2_GetPlayerAddress(p,a,b,c)      (p)->lpVtbl->GetPlayerAddress(p,a,b,c)
  377. #define IDirectPlay2_GetPlayerCaps(p,a,b,c)         (p)->lpVtbl->GetPlayerCaps(p,a,b,c)
  378. #define IDirectPlay2_GetPlayerData(p,a,b,c,d)       (p)->lpVtbl->GetPlayerData(p,a,b,c,d)
  379. #define IDirectPlay2_GetPlayerName(p,a,b,c)         (p)->lpVtbl->GetPlayerName(p,a,b,c)
  380. #define IDirectPlay2_GetSessionDesc(p,a,b)          (p)->lpVtbl->GetSessionDesc(p,a,b)
  381. #define IDirectPlay2_Initialize(p,a)                (p)->lpVtbl->Initialize(p,a)
  382. #define IDirectPlay2_Open(p,a,b)                    (p)->lpVtbl->Open(p,a,b)
  383. #define IDirectPlay2_Receive(p,a,b,c,d,e)           (p)->lpVtbl->Receive(p,a,b,c,d,e)
  384. #define IDirectPlay2_Send(p,a,b,c,d,e)              (p)->lpVtbl->Send(p,a,b,c,d,e)
  385. #define IDirectPlay2_SetGroupData(p,a,b,c,d)        (p)->lpVtbl->SetGroupData(p,a,b,c,d)
  386. #define IDirectPlay2_SetGroupName(p,a,b,c)          (p)->lpVtbl->SetGroupName(p,a,b,c)
  387. #define IDirectPlay2_SetPlayerData(p,a,b,c,d)       (p)->lpVtbl->SetPlayerData(p,a,b,c,d)
  388. #define IDirectPlay2_SetPlayerName(p,a,b,c)         (p)->lpVtbl->SetPlayerName(p,a,b,c)
  389. #define IDirectPlay2_SetSessionDesc(p,a,b)          (p)->lpVtbl->SetSessionDesc(p,a,b)
  390.  
  391. #else /* C++ */
  392.  
  393. #define IDirectPlay2_QueryInterface(p,a,b)          (p)->QueryInterface(a,b)
  394. #define IDirectPlay2_AddRef(p)                      (p)->AddRef()
  395. #define IDirectPlay2_Release(p)                     (p)->Release()
  396. #define IDirectPlay2_AddPlayerToGroup(p,a,b)        (p)->AddPlayerToGroup(a,b)
  397. #define IDirectPlay2_Close(p)                       (p)->Close()
  398. #define IDirectPlay2_CreateGroup(p,a,b,c,d,e)       (p)->CreateGroup(a,b,c,d,e)
  399. #define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f)    (p)->CreatePlayer(a,b,c,d,e,f)
  400. #define IDirectPlay2_DeletePlayerFromGroup(p,a,b)   (p)->DeletePlayerFromGroup(a,b)
  401. #define IDirectPlay2_DestroyGroup(p,a)              (p)->DestroyGroup(a)
  402. #define IDirectPlay2_DestroyPlayer(p,a)             (p)->DestroyPlayer(a)
  403. #define IDirectPlay2_EnableNewPlayers(p,a)          (p)->EnableNewPlayers(a)
  404. #define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e)  (p)->EnumGroupPlayers(a,b,c,d,e)
  405. #define IDirectPlay2_EnumGroups(p,a,b,c,d)          (p)->EnumGroups(a,b,c,d)
  406. #define IDirectPlay2_EnumPlayers(p,a,b,c,d)         (p)->EnumPlayers(a,b,c,d)
  407. #define IDirectPlay2_EnumSessions(p,a,b,c,d,e)      (p)->EnumSessions(a,b,c,d,e)
  408. #define IDirectPlay2_GetCaps(p,a,b)                 (p)->GetCaps(a,b)
  409. #define IDirectPlay2_GetMessageCount(p,a,b)         (p)->GetMessageCount(a,b)
  410. #define IDirectPlay2_GetGroupData(p,a,b,c,d)        (p)->GetGroupData(a,b,c,d)
  411. #define IDirectPlay2_GetGroupName(p,a,b,c)          (p)->GetGroupName(a,b,c)
  412. #define IDirectPlay2_GetPlayerAddress(p,a,b,c)      (p)->GetPlayerAddress(a,b,c)
  413. #define IDirectPlay2_GetPlayerCaps(p,a,b,c)         (p)->GetPlayerCaps(a,b,c)
  414. #define IDirectPlay2_GetPlayerData(p,a,b,c,d)       (p)->GetPlayerData(a,b,c,d)
  415. #define IDirectPlay2_GetPlayerName(p,a,b,c)         (p)->GetPlayerName(a,b,c)
  416. #define IDirectPlay2_GetSessionDesc(p,a,b)          (p)->GetSessionDesc(a,b)
  417. #define IDirectPlay2_Initialize(p,a)                (p)->Initialize(a)
  418. #define IDirectPlay2_Open(p,a,b)                    (p)->Open(a,b)
  419. #define IDirectPlay2_Receive(p,a,b,c,d,e)           (p)->Receive(a,b,c,d,e)
  420. #define IDirectPlay2_Send(p,a,b,c,d,e)              (p)->Send(a,b,c,d,e)
  421. #define IDirectPlay2_SetGroupData(p,a,b,c,d)        (p)->SetGroupData(a,b,c,d)
  422. #define IDirectPlay2_SetGroupName(p,a,b,c)          (p)->SetGroupName(a,b,c)
  423. #define IDirectPlay2_SetPlayerData(p,a,b,c,d)       (p)->SetPlayerData(a,b,c,d)
  424. #define IDirectPlay2_SetPlayerName(p,a,b,c)         (p)->SetPlayerName(a,b,c)
  425. #define IDirectPlay2_SetSessionDesc(p,a,b)          (p)->SetSessionDesc(a,b)
  426.  
  427. #endif
  428.  
  429. /****************************************************************************
  430.  *
  431.  * EnumPlayers API flags
  432.  *
  433.  ****************************************************************************/
  434.  
  435. /*
  436.  * Enumerate all players in the current session
  437.  */
  438. #define DPENUMPLAYERS_ALL           0x00000000
  439.  
  440. /*
  441.  * Enumerate only local (created by this application) players
  442.  */
  443. #define DPENUMPLAYERS_LOCAL         0x00000008
  444.  
  445. /*
  446.  * Enumerate only remote (non-local) players
  447.  */
  448. #define DPENUMPLAYERS_REMOTE        0x00000010
  449.  
  450. /*
  451.  * Enumerate groups along with the players
  452.  */
  453. #define DPENUMPLAYERS_GROUP         0x00000020
  454.  
  455. /*
  456.  * Enumerate players in another session (must supply lpguidInstance)
  457.  */
  458. #define DPENUMPLAYERS_SESSION       0x00000080
  459.  
  460.  
  461. /****************************************************************************
  462.  *
  463.  * EnumSessions API flags
  464.  *
  465.  ****************************************************************************/
  466.  
  467. /*
  468.  * Enumerate sessions which can be joined
  469.  */
  470. #define DPENUMSESSIONS_AVAILABLE    0x00000001 
  471.  
  472. /*
  473.  * Enumerate all sessions even if they can't be joined.
  474.  */
  475. #define DPENUMSESSIONS_ALL          0x00000002
  476.  
  477.  
  478.  
  479.  
  480.  
  481. /****************************************************************************
  482.  *
  483.  * GetCaps and GetPlayerCaps API flags
  484.  *
  485.  ****************************************************************************/
  486.  
  487. /*
  488.  * The latency returned should be for guaranteed message sending.
  489.  * Default is non-guaranteed messaging.
  490.  */
  491. #define DPGETCAPS_GUARANTEED        0x00000001 
  492.  
  493.  
  494. /****************************************************************************
  495.  *
  496.  * GetGroupData, GetPlayerData API flags
  497.  * Remote and local Group/Player data is maintained separately. 
  498.  * Default is DPGET_REMOTE.
  499.  *
  500.  ****************************************************************************/
  501.  
  502. /*
  503.  * Get the remote data (set by any DirectPlay object in
  504.  * the session using DPSET_REMOTE)
  505.  */
  506. #define DPGET_REMOTE                0x00000000
  507.  
  508. /*
  509.  * Get the local data (set by this DirectPlay object 
  510.  * using DPSET_LOCAL)
  511.  */
  512. #define DPGET_LOCAL                 0x00000001
  513.  
  514.  
  515. /****************************************************************************
  516.  *
  517.  * Open API flags
  518.  *
  519.  ****************************************************************************/
  520.  
  521. /*
  522.  * Join the session that is described by the DPSESSIONDESC2 structure
  523.  */
  524. #define DPOPEN_JOIN                 0x00000001
  525.  
  526. /*
  527.  * Create a new session as described by the DPSESSIONDESC2 structure
  528.  */
  529. #define DPOPEN_CREATE               0x00000002
  530.  
  531. /****************************************************************************
  532.  *
  533.  * Receive API flags
  534.  * Default is DPRECEIVE_ALL
  535.  *
  536.  ****************************************************************************/
  537.  
  538. /*
  539.  * Get the first message in the queue
  540.  */
  541. #define DPRECEIVE_ALL               0x00000001
  542.  
  543. /*
  544.  * Get the first message in the queue directed to a specific player 
  545.  */
  546. #define DPRECEIVE_TOPLAYER          0x00000002
  547.  
  548. /*
  549.  * Get the first message in the queue from a specific player
  550.  */
  551. #define DPRECEIVE_FROMPLAYER        0x00000004
  552.  
  553. /*
  554.  * Get the message but don't remove it from the queue
  555.  */
  556. #define DPRECEIVE_PEEK              0x00000008
  557.  
  558.  
  559. /****************************************************************************
  560.  *
  561.  * Send API flags
  562.  *
  563.  ****************************************************************************/
  564.  
  565. /*
  566.  * Send the message using a guaranteed send method.
  567.  * Default is non-guaranteed.
  568.  */
  569. #define DPSEND_GUARANTEED           0x00000001
  570.  
  571. /*
  572.  * Send the message high-priority. Move to front of
  573.  * send queue of sender and the receive queue of the
  574.  * receipient
  575.  */
  576. #define DPSEND_HIGHPRIORITY         0x00000002
  577.  
  578. /*
  579.  * Application will be sending several more guaranteed messages to
  580.  * this player so the service provider may want to optimize for this.
  581.  * Implementation of this flag by a service provider is optional.
  582.  */
  583. #define DPSEND_OPENSTREAM           0x00000008
  584.  
  585. /*
  586.  * The optimization requested by DPSEND_OPENSTREAM is no longer
  587.  * needed.  Resources allocated for DPSEND_OPENSTREAM may be released.
  588.  */
  589. #define DPSEND_CLOSESTREAM          0x00000010
  590.  
  591.  
  592. /****************************************************************************
  593.  *
  594.  * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName,
  595.  * SetSessionDesc API flags.
  596.  * Default is DPSET_REMOTE.
  597.  *
  598.  ****************************************************************************/
  599.  
  600. /* 
  601.  * Propagate the data to all players in the session
  602.  */
  603. #define DPSET_REMOTE                0x00000000
  604.  
  605. /*
  606.  * Do not propagate the data to other players
  607.  */
  608. #define DPSET_LOCAL                 0x00000001
  609.  
  610. /*
  611.  * Used with DPSET_REMOTE, use guaranteed message send to
  612.  * propagate the data
  613.  */
  614. #define DPSET_GUARANTEED            0x00000002
  615.  
  616.  
  617. /****************************************************************************
  618.  *
  619.  * DirectPlay system messages and message data structures
  620.  *
  621.  * All system message come 'From' player DPID_SYSMSG.  To determine what type 
  622.  * of message it is, cast the lpData from Receive to DPMSG_GENERIC and check
  623.  * the dwType member against one of the following DPSYS_xxx constants. Once
  624.  * a match is found, cast the lpData to the corresponding of the DPMSG_xxx
  625.  * structures to access the data of the message.
  626.  *
  627.  ****************************************************************************/
  628.  
  629. /*
  630.  * A new player or group has been created in the session
  631.  * Use DPMSG_CREATEPLAYERORGROUP.  Check dwPlayerType to see if it
  632.  * is a player or a group.
  633.  */
  634. #define DPSYS_CREATEPLAYERORGROUP   0x0003  
  635.  
  636. /*
  637.  * A player has been deleted from the session
  638.  * Use DPMSG_DESTROYPLAYERORGROUP
  639.  */
  640. #define DPSYS_DESTROYPLAYERORGROUP  0x0005  
  641.  
  642. /*
  643.  * A player has been added to a group
  644.  * Use DPMSG_ADDPLAYERTOGROUP
  645.  */
  646. #define DPSYS_ADDPLAYERTOGROUP      0x0007  
  647.  
  648. /*
  649.  * A player has been removed from a group
  650.  * Use DPMSG_DELETEPLAYERFROMGROUP
  651.  */
  652. #define DPSYS_DELETEPLAYERFROMGROUP 0x0021  
  653.  
  654. /*
  655.  * This DirectPlay object lost its connection with all the
  656.  * other players in the session.
  657.  * Use DPMSG_SESSIONLOST.
  658.  */
  659. #define DPSYS_SESSIONLOST           0x0031
  660.  
  661. /*
  662.  * The current host has left the session.
  663.  * This DirectPlay object is now the host.
  664.  * Use DPMSG_HOST.
  665.  */
  666. #define DPSYS_HOST                  0x0101
  667.  
  668. /*
  669.  * The remote data associated with a player or
  670.  * group has changed. Check dwPlayerType to see
  671.  * if it is a player or a group
  672.  * Use DPMSG_SETPLAYERORGROUPDATA
  673.  */
  674. #define DPSYS_SETPLAYERORGROUPDATA  0x0102
  675.  
  676. /*
  677.  * The name of a player or group has changed.
  678.  * Check dwPlayerType to see if it is a player
  679.  * or a group.
  680.  * Use DPMSG_SETPLAYERORGROUPNAME
  681.  */
  682. #define DPSYS_SETPLAYERORGROUPNAME  0x0103
  683.  
  684. /*
  685.  * Used in the dwPlayerType field to indicate if it applies to a group
  686.  * or a player
  687.  */
  688. #define DPPLAYERTYPE_GROUP          0x00000000
  689. #define DPPLAYERTYPE_PLAYER         0x00000001
  690.  
  691. /*
  692.  * DPMSG_GENERIC
  693.  * Generic message structure used to identify the message type.
  694.  */
  695. typedef struct
  696. {
  697.     DWORD       dwType;         // Message type
  698. } DPMSG_GENERIC, FAR *LPDPMSG_GENERIC;
  699.  
  700. /*
  701.  * DPMSG_CREATEPLAYERORGROUP
  702.  * System message generated when a new player or group
  703.  * created in the session with information about it.
  704.  */
  705. typedef struct
  706. {
  707.     DWORD       dwType;         // Message type
  708.     DWORD       dwPlayerType;   // Is it a player or group
  709.     DPID        dpId;           // ID of the player or group
  710.     DWORD       dwCurrentPlayers;   // current # players & groups in session
  711.     LPVOID      lpData;         // pointer to remote data
  712.     DWORD       dwDataSize;     // size of remote data
  713.     DPNAME      dpnName;        // structure with name info
  714. } DPMSG_CREATEPLAYERORGROUP, FAR *LPDPMSG_CREATEPLAYERORGROUP;
  715.  
  716. /*
  717.  * DPMSG_DESTROYPLAYERORGROUP
  718.  * System message generated when a player or group is being
  719.  * destroyed in the session with information about it.
  720.  */
  721. typedef struct
  722. {
  723.     DWORD       dwType;         // Message type
  724.     DWORD       dwPlayerType;   // Is it a player or group
  725.     DPID        dpId;           // player ID being deleted
  726.     LPVOID      lpLocalData;    // copy of players local data
  727.     DWORD       dwLocalDataSize; // sizeof local data
  728.     LPVOID      lpRemoteData;   // copy of players remote data
  729.     DWORD       dwRemoteDataSize; // sizeof remote data
  730. } DPMSG_DESTROYPLAYERORGROUP, FAR *LPDPMSG_DESTROYPLAYERORGROUP;
  731.  
  732. /*
  733.  * DPMSG_ADDPLAYERTOGROUP
  734.  * System message generated when a player is being added
  735.  * to a group.
  736.  */
  737. typedef struct
  738. {
  739.     DWORD       dwType;         // Message type
  740.     DPID        dpIdGroup;      // group ID being added to
  741.     DPID        dpIdPlayer;     // player ID being added
  742. } DPMSG_ADDPLAYERTOGROUP, FAR *LPDPMSG_ADDPLAYERTOGROUP;
  743.  
  744. /*
  745.  * DPMSG_DELETEPLAYERFROMGROUP
  746.  * System message generated when a player is being
  747.  * removed from a group
  748.  */
  749. typedef DPMSG_ADDPLAYERTOGROUP          DPMSG_DELETEPLAYERFROMGROUP;
  750. typedef DPMSG_DELETEPLAYERFROMGROUP     FAR *LPDPMSG_DELETEPLAYERFROMGROUP;
  751.  
  752. /*
  753.  * DPMSG_SETPLAYERORGROUPDATA
  754.  * System message generated when remote data for a player or
  755.  * group has changed.
  756.  */
  757. typedef struct
  758. {
  759.     DWORD       dwType;         // Message type
  760.     DWORD       dwPlayerType;   // Is it a player or group
  761.     DPID        dpId;           // ID of player or group
  762.     LPVOID      lpData;         // pointer to remote data
  763.     DWORD       dwDataSize;     // size of remote data
  764. } DPMSG_SETPLAYERORGROUPDATA, FAR *LPDPMSG_SETPLAYERORGROUPDATA;
  765.  
  766. /*
  767.  * DPMSG_SETPLAYERORGROUPNAME
  768.  * System message generated when the name of a player or
  769.  * group has changed.
  770.  */
  771. typedef struct
  772. {
  773.     DWORD       dwType;         // Message type
  774.     DWORD       dwPlayerType;   // Is it a player or group
  775.     DPID        dpId;           // ID of player or group
  776.     DPNAME      dpnName;        // structure with new name info
  777. } DPMSG_SETPLAYERORGROUPNAME, FAR *LPDPMSG_SETPLAYERORGROUPNAME;
  778.  
  779. /*
  780.  * DPMSG_HOST
  781.  * System message generated when the host has migrated to this
  782.  * DirectPlay object.
  783.  *
  784.  */
  785. typedef DPMSG_GENERIC       DPMSG_HOST;
  786. typedef DPMSG_HOST          FAR *LPDPMSG_HOST;
  787.  
  788. /*
  789.  * DPMSG_SESSIONLOST
  790.  * System message generated when the connection to the session is lost.
  791.  *
  792.  */
  793. typedef DPMSG_GENERIC       DPMSG_SESSIONLOST;
  794. typedef DPMSG_SESSIONLOST   FAR *LPDPMSG_SESSIONLOST;
  795.  
  796. /****************************************************************************
  797.  *
  798.  * DIRECTPLAY ERRORS
  799.  *
  800.  * Errors are represented by negative values and cannot be combined.
  801.  *
  802.  ****************************************************************************/
  803. #define DP_OK                           S_OK
  804. #define DPERR_ALREADYINITIALIZED        MAKE_DPHRESULT(   5 )
  805. #define DPERR_ACCESSDENIED              MAKE_DPHRESULT(  10 )
  806. #define DPERR_ACTIVEPLAYERS             MAKE_DPHRESULT(  20 )
  807. #define DPERR_BUFFERTOOSMALL            MAKE_DPHRESULT(  30 )
  808. #define DPERR_CANTADDPLAYER             MAKE_DPHRESULT(  40 )
  809. #define DPERR_CANTCREATEGROUP           MAKE_DPHRESULT(  50 )
  810. #define DPERR_CANTCREATEPLAYER          MAKE_DPHRESULT(  60 )
  811. #define DPERR_CANTCREATESESSION         MAKE_DPHRESULT(  70 )
  812. #define DPERR_CAPSNOTAVAILABLEYET       MAKE_DPHRESULT(  80 )
  813. #define DPERR_EXCEPTION                 MAKE_DPHRESULT(  90 )
  814. #define DPERR_GENERIC                   E_FAIL
  815. #define DPERR_INVALIDFLAGS              MAKE_DPHRESULT( 120 )
  816. #define DPERR_INVALIDOBJECT             MAKE_DPHRESULT( 130 )
  817. #define DPERR_INVALIDPARAM              E_INVALIDARG
  818. #define DPERR_INVALIDPARAMS             DPERR_INVALIDPARAM
  819. #define DPERR_INVALIDPLAYER             MAKE_DPHRESULT( 150 )
  820. #define DPERR_NOCAPS                    MAKE_DPHRESULT( 160 )
  821. #define DPERR_NOCONNECTION              MAKE_DPHRESULT( 170 )
  822. #define DPERR_NOMEMORY                  E_OUTOFMEMORY
  823. #define DPERR_OUTOFMEMORY               DPERR_NOMEMORY
  824. #define DPERR_NOMESSAGES                MAKE_DPHRESULT( 190 )
  825. #define DPERR_NONAMESERVERFOUND         MAKE_DPHRESULT( 200 )
  826. #define DPERR_NOPLAYERS                 MAKE_DPHRESULT( 210 )
  827. #define DPERR_NOSESSIONS                MAKE_DPHRESULT( 220 )
  828. #define DPERR_SENDTOOBIG                MAKE_DPHRESULT( 230 )
  829. #define DPERR_TIMEOUT                   MAKE_DPHRESULT( 240 )
  830. #define DPERR_UNAVAILABLE               MAKE_DPHRESULT( 250 )
  831. #define DPERR_UNSUPPORTED               E_NOTIMPL
  832. #define DPERR_BUSY                      MAKE_DPHRESULT( 270 )
  833. #define DPERR_USERCANCEL                MAKE_DPHRESULT( 280 ) 
  834. #define DPERR_NOINTERFACE               E_NOINTERFACE
  835. #define DPERR_CANNOTCREATESERVER        MAKE_DPHRESULT( 290 )
  836. #define DPERR_PLAYERLOST                MAKE_DPHRESULT( 300 )
  837. #define DPERR_SESSIONLOST               MAKE_DPHRESULT( 310 )
  838.  
  839.  
  840. #define DPERR_BUFFERTOOLARGE            MAKE_DPHRESULT( 1000 )
  841. #define DPERR_CANTCREATEPROCESS         MAKE_DPHRESULT( 1010 )
  842. #define DPERR_APPNOTSTARTED             MAKE_DPHRESULT( 1020 )
  843. #define DPERR_INVALIDINTERFACE          MAKE_DPHRESULT( 1030 )
  844. #define DPERR_NOSERVICEPROVIDER         MAKE_DPHRESULT( 1040 )
  845. #define DPERR_UNKNOWNAPPLICATION        MAKE_DPHRESULT( 1050 )
  846. #define DPERR_NOTLOBBIED                MAKE_DPHRESULT( 1070 )
  847.  
  848.  
  849. /****************************************************************************
  850.  *
  851.  *      dplay 1.0 obsolete structures + interfaces
  852.  *      Included for compatibility only. New apps should
  853.  *      use IDirectPlay2
  854.  *
  855.  ****************************************************************************/
  856.  
  857. // define this to ignore obsolete interfaces and constants
  858. #ifndef IDIRECTPLAY2_OR_GREATER
  859.  
  860. #define DPOPEN_OPENSESSION          DPOPEN_JOIN
  861. #define DPOPEN_CREATESESSION        DPOPEN_CREATE
  862.  
  863. #define DPENUMSESSIONS_PREVIOUS     0x00000004
  864.  
  865. #define DPENUMPLAYERS_PREVIOUS      0x00000004
  866.  
  867. #define DPSEND_GUARANTEE            DPSEND_GUARANTEED
  868. #define DPSEND_TRYONCE              0x00000004
  869.  
  870. #define DPCAPS_NAMESERVICE          0x00000001
  871. #define DPCAPS_NAMESERVER           DPCAPS_ISHOST
  872. #define DPCAPS_GUARANTEED           0x00000004
  873.  
  874. #define DPLONGNAMELEN               52
  875. #define DPSHORTNAMELEN              20
  876. #define DPSESSIONNAMELEN            32
  877. #define DPPASSWORDLEN               16
  878. #define DPUSERRESERVED              16
  879.  
  880. #define DPSYS_ADDPLAYER             0x0003
  881. #define DPSYS_DELETEPLAYER          0x0005
  882.  
  883. #define DPSYS_DELETEGROUP           0x0020
  884. #define DPSYS_DELETEPLAYERFROMGRP   0x0021
  885. #define DPSYS_CONNECT               0x484b
  886.  
  887. typedef struct
  888. {
  889.     DWORD       dwType;
  890.     DWORD       dwPlayerType;
  891.     DPID        dpId;
  892.     char        szLongName[DPLONGNAMELEN];
  893.     char        szShortName[DPSHORTNAMELEN];
  894.     DWORD       dwCurrentPlayers;
  895. }   DPMSG_ADDPLAYER;
  896.  
  897. typedef DPMSG_ADDPLAYER DPMSG_ADDGROUP;
  898.  
  899. typedef struct
  900. {
  901.     DWORD       dwType;
  902.     DPID        dpIdGroup;
  903.     DPID        dpIdPlayer;
  904. } DPMSG_GROUPADD;
  905.  
  906. typedef DPMSG_GROUPADD DPMSG_GROUPDELETE;
  907. typedef struct
  908. {
  909.     DWORD       dwType;
  910.     DPID        dpId;
  911. } DPMSG_DELETEPLAYER;
  912.  
  913. typedef BOOL (PASCAL *LPDPENUMPLAYERSCALLBACK)(
  914.     DPID    dpId,
  915.     LPSTR   lpFriendlyName,
  916.     LPSTR   lpFormalName,
  917.     DWORD   dwFlags,
  918.     LPVOID  lpContext );
  919.  
  920. typedef struct
  921. {
  922.     DWORD   dwSize;
  923.     GUID    guidSession;                  
  924.     DWORD   dwSession;                    
  925.     DWORD   dwMaxPlayers;                 
  926.     DWORD   dwCurrentPlayers;             
  927.     DWORD   dwFlags;                      
  928.     char    szSessionName[DPSESSIONNAMELEN];
  929.     char    szUserField[DPUSERRESERVED];
  930.     DWORD   dwReserved1;                  
  931.     char    szPassword[DPPASSWORDLEN];    
  932.     DWORD   dwReserved2;                  
  933.     DWORD   dwUser1;
  934.     DWORD   dwUser2;
  935.     DWORD   dwUser3;
  936.     DWORD   dwUser4;
  937. } DPSESSIONDESC,*LPDPSESSIONDESC;
  938.  
  939. typedef BOOL (PASCAL * LPDPENUMSESSIONSCALLBACK)(
  940.     LPDPSESSIONDESC lpDPSessionDesc,
  941.     LPVOID      lpContext,
  942.     LPDWORD     lpdwTimeOut,
  943.     DWORD       dwFlags);
  944.  
  945. /*
  946.  * IDirectPlay
  947.  */
  948. #undef INTERFACE
  949. #define INTERFACE IDirectPlay
  950. DECLARE_INTERFACE_( IDirectPlay, IUnknown )
  951. {
  952.     /*** IUnknown methods ***/
  953.     STDMETHOD(QueryInterface)       (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  954.     STDMETHOD_(ULONG,AddRef)        (THIS)  PURE;
  955.     STDMETHOD_(ULONG,Release)       (THIS) PURE;
  956.     /*** IDirectPlay methods ***/
  957.     STDMETHOD(AddPlayerToGroup)     (THIS_ DPID, DPID) PURE;
  958.     STDMETHOD(Close)                (THIS) PURE;
  959.     STDMETHOD(CreatePlayer)         (THIS_ LPDPID,LPSTR,LPSTR,LPHANDLE) PURE;
  960.     STDMETHOD(CreateGroup)          (THIS_ LPDPID,LPSTR,LPSTR) PURE;
  961.     STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE;
  962.     STDMETHOD(DestroyPlayer)        (THIS_ DPID) PURE;
  963.     STDMETHOD(DestroyGroup)         (THIS_ DPID) PURE;
  964.     STDMETHOD(EnableNewPlayers)     (THIS_ BOOL) PURE;
  965.     STDMETHOD(EnumGroupPlayers)     (THIS_ DPID, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE;
  966.     STDMETHOD(EnumGroups)           (THIS_ DWORD, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE;
  967.     STDMETHOD(EnumPlayers)          (THIS_ DWORD, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE;
  968.     STDMETHOD(EnumSessions)         (THIS_ LPDPSESSIONDESC,DWORD,LPDPENUMSESSIONSCALLBACK,LPVOID,DWORD) PURE;
  969.     STDMETHOD(GetCaps)              (THIS_ LPDPCAPS) PURE;
  970.     STDMETHOD(GetMessageCount)      (THIS_ DPID, LPDWORD) PURE;
  971.     STDMETHOD(GetPlayerCaps)        (THIS_ DPID, LPDPCAPS) PURE;
  972.     STDMETHOD(GetPlayerName)        (THIS_ DPID,LPSTR,LPDWORD,LPSTR,LPDWORD) PURE;
  973.     STDMETHOD(Initialize)           (THIS_ LPGUID) PURE;
  974.     STDMETHOD(Open)                 (THIS_ LPDPSESSIONDESC) PURE;
  975.     STDMETHOD(Receive)              (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE;
  976.     STDMETHOD(SaveSession)          (THIS_ LPSTR) PURE;
  977.     STDMETHOD(Send)                 (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE;
  978.     STDMETHOD(SetPlayerName)        (THIS_ DPID,LPSTR,LPSTR) PURE;
  979. };
  980.  
  981. /****************************************************************************
  982.  *
  983.  * IDirectPlay interface macros
  984.  *
  985.  ****************************************************************************/
  986.  
  987. #if !defined(__cplusplus) || defined(CINTERFACE)
  988.  
  989. #define IDirectPlay_AddPlayerToGroup(p,a,b)         (p)->lpVtbl->AddPlayerToGroup(p,a,b)
  990. #define IDirectPlay_Close(p)                        (p)->lpVtbl->Close(p)
  991. #define IDirectPlay_CreateGroup(p,a,b,c)            (p)->lpVtbl->CreateGroup(p,a,b,c)
  992. #define IDirectPlay_CreatePlayer(p,a,b,c,d)         (p)->lpVtbl->CreatePlayer(p,a,b,c,d)
  993. #define IDirectPlay_DeletePlayerFromGroup(p,a,b)    (p)->lpVtbl->DeletePlayerFromGroup(p,a,b)
  994. #define IDirectPlay_DestroyGroup(p,a)               (p)->lpVtbl->DestroyGroup(p,a)
  995. #define IDirectPlay_DestroyPlayer(p,a)              (p)->lpVtbl->DestroyPlayer(p,a)
  996. #define IDirectPlay_EnableNewPlayers(p,a)           (p)->lpVtbl->EnableNewPlayers(p,a)
  997. #define IDirectPlay_EnumGroupPlayers(p,a,b,c,d)     (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d)
  998. #define IDirectPlay_EnumGroups(p,a,b,c,d)           (p)->lpVtbl->EnumGroups(p,a,b,c,d)
  999. #define IDirectPlay_EnumPlayers(p,a,b,c,d)          (p)->lpVtbl->EnumPlayers(p,a,b,c,d)
  1000. #define IDirectPlay_EnumSessions(p,a,b,c,d,e)       (p)->lpVtbl->EnumSessions(p,a,b,c,d,e)
  1001. #define IDirectPlay_GetCaps(p,a)                    (p)->lpVtbl->GetCaps(p,a)
  1002. #define IDirectPlay_GetMessageCount(p,a,b)          (p)->lpVtbl->GetMessageCount(p,a,b)
  1003. #define IDirectPlay_GetPlayerCaps(p,a,b)            (p)->lpVtbl->GetPlayerCaps(p,a,b)
  1004. #define IDirectPlay_GetPlayerName(p,a,b,c,d,e)      (p)->lpVtbl->GetPlayerName(p,a,b,c,d,e)
  1005. #define IDirectPlay_Initialize(p,a)                 (p)->lpVtbl->Initialize(p,a)
  1006. #define IDirectPlay_Open(p,a)                       (p)->lpVtbl->Open(p,a)
  1007. #define IDirectPlay_Receive(p,a,b,c,d,e)            (p)->lpVtbl->Receive(p,a,b,c,d,e)
  1008. #define IDirectPlay_SaveSession(p,a)                (p)->lpVtbl->SaveSession(p,a)
  1009. #define IDirectPlay_Send(p,a,b,c,d,e)               (p)->lpVtbl->Send(p,a,b,c,d,e)
  1010. #define IDirectPlay_SetPlayerName(p,a,b,c)          (p)->lpVtbl->SetPlayerName(p,a,b,c)
  1011.  
  1012. #else /* C++ */
  1013.  
  1014. #define IDirectPlay_AddPlayerToGroup(p,a,b)         (p)->AddPlayerToGroup(a,b)
  1015. #define IDirectPlay_Close(p)                        (p)->Close()
  1016. #define IDirectPlay_CreateGroup(p,a,b,c)            (p)->CreateGroup(a,b,c)
  1017. #define IDirectPlay_CreatePlayer(p,a,b,c,d)         (p)->CreatePlayer(a,b,c,d)
  1018. #define IDirectPlay_DeletePlayerFromGroup(p,a,b)    (p)->DeletePlayerFromGroup(a,b)
  1019. #define IDirectPlay_DestroyGroup(p,a)               (p)->DestroyGroup(a)
  1020. #define IDirectPlay_DestroyPlayer(p,a)              (p)->DestroyPlayer(a)
  1021. #define IDirectPlay_EnableNewPlayers(p,a)           (p)->EnableNewPlayers(a)
  1022. #define IDirectPlay_EnumGroupPlayers(p,a,b,c,d)     (p)->EnumGroupPlayers(a,b,c,d)
  1023. #define IDirectPlay_EnumGroups(p,a,b,c,d)           (p)->EnumGroups(a,b,c,d)
  1024. #define IDirectPlay_EnumPlayers(p,a,b,c,d)          (p)->EnumPlayers(a,b,c,d)
  1025. #define IDirectPlay_EnumSessions(p,a,b,c,d,e)       (p)->EnumSessions(a,b,c,d,e)
  1026. #define IDirectPlay_GetCaps(p,a)                    (p)->GetCaps(a)
  1027. #define IDirectPlay_GetMessageCount(p,a,b)          (p)->GetMessageCount(a,b)
  1028. #define IDirectPlay_GetPlayerCaps(p,a,b)            (p)->GetPlayerCaps(a,b)
  1029. #define IDirectPlay_GetPlayerName(p,a,b,c,d,e)      (p)->GetPlayerName(a,b,c,d,e)
  1030. #define IDirectPlay_Initialize(p,a)                 (p)->Initialize(a)
  1031. #define IDirectPlay_Open(p,a)                       (p)->Open(a)
  1032. #define IDirectPlay_Receive(p,a,b,c,d,e)            (p)->Receive(a,b,c,d,e)
  1033. #define IDirectPlay_SaveSession(p,a)                (p)->SaveSession(a)
  1034. #define IDirectPlay_Send(p,a,b,c,d,e)               (p)->Send(a,b,c,d,e)
  1035. #define IDirectPlay_SetPlayerName(p,a,b,c)          (p)->SetPlayerName(a,b,c)
  1036.  
  1037. #endif
  1038.  
  1039. DEFINE_GUID(IID_IDirectPlay, 0x5454e9a0, 0xdb65, 0x11ce, 0x92, 0x1c, 0x00, 0xaa, 0x00, 0x6c, 0x49, 0x72);
  1040.  
  1041. #endif // IDIRECTPLAY2_OR_GREATER
  1042.  
  1043. /****************************************************************************
  1044.  *
  1045.  * IDirectPlay macros (included regardless of IDIRECTPLAY2_OR_GREATER flag)
  1046.  *
  1047.  ****************************************************************************/
  1048.  
  1049. #if !defined(__cplusplus) || defined(CINTERFACE)
  1050.  
  1051. #define IDirectPlay_QueryInterface(p,a,b)           (p)->lpVtbl->QueryInterface(p,a,b)
  1052. #define IDirectPlay_AddRef(p)                       (p)->lpVtbl->AddRef(p)
  1053. #define IDirectPlay_Release(p)                      (p)->lpVtbl->Release(p)
  1054.  
  1055. #else
  1056.  
  1057. #define IDirectPlay_QueryInterface(p,a,b)           (p)->QueryInterface(a,b)
  1058. #define IDirectPlay_AddRef(p)                       (p)->AddRef()
  1059. #define IDirectPlay_Release(p)                      (p)->Release()
  1060.  
  1061. #endif // IDirectPlay interface macros 
  1062.  
  1063. #ifdef __cplusplus
  1064. };
  1065. #endif
  1066.  
  1067. #pragma option pop
  1068. #endif
  1069.